'use strict';let _a=_Et(function*(a,f,b,d){if(!b.url&&!b.bookmarkId)return f(a);let c=[],e=[],g=!1;if(b.bookmarkId&&_Ky.bookmarks){var h=yield m=>_Ky.bookmarks.getSubTree(""+b.bookmarkId,m);if(!_fy()&&h.length)if(h[0].url)e=[h[0].url];else{g=!0;for(var k of h[0].children)k.url&&e.push(k.url)}}(h=b.refTab)&&"number"!=typeof h&&(h=(yield _fr(d,_4j,h))[0][0]);h=_os[h]||_os[_Ca];h||(b=b.sc().add({tabPos:"newWin"}),h={});let n=h.windowId;a=_Nd(a);a=b.tabPos&&!b.usesTabs?[]:a;let q=(h.index||0)+("after"==
b.tabPos?1:0);a.length||(a=[void 0]);for(h=0;h<a.length;){k=h;b.bookmarkId||(e=_Mg(b.url)?b.url:yield _fr(d,_6s,_Mu(b.url||"chrome://newtab"),_os[a[h]]));for(let m of e)if(m=m.trim().match(/^.*/)[0].trim(),_Zk(m)){_ua=Date.now();if("newWin"==b.tabPos)if(0==h||"popup"==b.winType){var l=yield p=>_Gj({url:m,focused:!1,incognito:b.incognito,type:b.winType},p);!_fy()&&l&&(n=l.id,c.push(l.tabs[0].id))}else(l=yield p=>_Yi({url:m,active:!1,windowId:n},p))&&c.push(l.id);else if(b.tabPos)(l=yield p=>_Yi({url:m,
active:!1,windowId:n,index:q++},p))&&c.push(l.id);else if(l=a[h],0<l)m.startsWith("javascript:")?_rk(l,{code:m.slice(11)})():_Ky.tabs.update(l,{url:m}),c.push(l);else if(b.newTabs){let p=_Kg(_os[a[a.length-1]||_Ca],"windowId");(l=yield r=>_Yi({url:m,active:!1,windowId:p},r))&&c.push(l.id)}++h}if(g||1<e.length&&1<a.length)break;h==k&&++h}f([c])});
function _nh(a){return[{sequence:[{action:"loadUrls",params:{url:"blank"==a.page?"about:blank":"chrome://newtab",tabPos:"after",refTab:"lastTab"}},{action:"activateTabs"}]}]}function _yl(a,f,b){let d=new _do;for(let c of _Nd(a))0<c&&_Ky.tabs.reload(c,{bypassCache:!!b.force},d.onReady());d.setCallback(()=>f(a))}function _ng(a){return _os[a].active&&_Hd(_os[a].window)}
function _Qw(a,f,b,d,c){let e=new _do;for(let g of _Nd(d))if(0<g)if(_Ky.tabs[a])_Ky.tabs[a](g,e.onReady());else _ng(g)?_So(_Ld,b,e.onReady()):_rk(g,{code:f})(e.onReady());e.setCallback(()=>c(d))}function _ri(a,f){_Qw("goBack","history.back()",[_my,_hr,_hr|_Go,_my|_Go],a,f)}function _9e(a,f){_Qw("goForward","history.forward()",[_my,_Xa,_Xa|_Go,_my|_Go],a,f)}
function _qt(a,f){let b=new _do;for(let d of _Nd(a)){if(!(0<d))continue;let c=_os[d],e=_uj(c.url);e!=c.url&&_Ky.tabs.update(d,{url:e},b.onReady())}b.setCallback(()=>f(a))}
function _Zu(a,f,b={}){let d=new _do;var c={};for(let e of _Nd(a))_os[e]&&_ih(c,_os[e].windowId,[]).push(e);a=Object.keys(_sk);for(let [e,g]of c)c=_sk[e],c.tabs.length==g.length?"devtools"!=c.type&&(("lastWin"==b.keepWin?1==a.length:b.keepWin)&&"normal"==c.type?(_Yi({url:"about:blank",active:!1,windowId:+e},d.onReady()),_Ky.tabs.remove(g,d.onReady())):(_Ky.windows.remove(+e,d.onReady()),a.remove(e))):((c=_Cf(e,g,b.switchTo))&&_Ky.tabs.update(c,{active:!0}),_Ky.tabs.remove(g,d.onReady()));d.setCallback(_Et(function*(...e){f([e.filter(g=>
g).map(g=>g.id)])}),1E3)}function _Cf(a,f,b){const [d]=f.filter(c=>_os[c].active);if(d&&b){a=_sk[a].tabs.map(e=>e.id);const c=_3u(a,f);if(1<c.length){const e=a.indexOf(d);switch(b){case "prevUsedTab":return _1(c,_Ek,!0).slice(-1)[0];case "openerTab":return _0p(_6u(d),c)[0];case "leftTab":return _3u(a.slice(0,e),f).slice(-1)[0]||_3u(a.slice(e+1),f)[0];case "rightTab":return _3u(a.slice(e+1),f)[0]||_3u(a.slice(0,e),f).slice(-1)[0];case "firstTab":return c[0];case "lastTab":return c[c.length-1]}}}}
function _6u(a){let f=[];for(;a=_Qy(_os[a],"openerTabId");)f.push(a);return f}function _Qs(a){return[{sequence:[{action:"closeTabs",params:a}],targets:"currentTab"}]}
function*_wa(a,f,b,d){const c={[_Bs]:"href",[_ld]:"hostname",[_Ay]:"pathname"};let e=h=>!b||b.regex.test((new URL(h.url))[c[b.part]])==!b.negate,g=_Kg(_os,_Ca,"windowId");for(let h of a)h.window?"tab"==f?yield*_wa(h.window.tabs,f,b,d):h.window.tabs.some(e)&&(yield h.window.sessionId):f&&"tab"!=f||(a=h.tab||h,e(a)&&(!d||g&&g==_yr[a.sessionId])&&(yield a.sessionId))}
let _0w=_Et(function*(a,f,b,d){let c;if(a=(b.urlTest||{}).value)d=yield _fr(d,_yy,_Mu(a),_os[_Ca]),c=b.urlTest.sc().add({part:_ld,value:d,regex:_0h(d,b.urlTest.type)});d=0;a=[];let e=b.maxObjs||1;if(_Ky.sessions){var g=yield h=>_Ky.sessions.getRecentlyClosed(b.objType||c||b.currWinTabs?{}:{maxResults:Math.min(e,_Ky.sessions.MAX_SESSION_RESULTS)},h);for(let h of _wa(g,b.objType,c,b.currWinTabs))if(g=yield k=>_Ky.sessions.restore(h,k),!_fy()&&g&&a.push(...g.tab?[g.tab.id]:g.window.tabs.map(k=>k.id)),
++d>=e)break}f([a])});function _7(a,f){let b=[],d=new _do;for(let c of _Nd(a))0<c&&_Ky.tabs.duplicate(c,d.onReady(e=>b.push(e.id)));d.setCallback(()=>f(b))}function _pi(a,f=_Qu,b={}){let d=new _do;for(let c of _Nd(a)){let e=_os[c];0<c&&e&&(b.peek&&(_Is[c]=1),e.active?2==_Is[c]&&_du(c,e.windowId!=_Pd):_Ky.tabs.update(c,{active:!0},d.onReady()))}d.setCallback(()=>f(a))}
function _Sh(a,f){let b=new _do;for(let d of _Nd(a))0<d&&_Ky.tabs.discard&&_Ky.tabs.discard(d,b.onReady());b.setCallback(()=>f(a))}function _Vf(a,f){_a([],f,{url:_Nd(a).filter(b=>0<b).map(b=>_7j(_os[b])),tabPos:"newWin",incognito:!0})}function _Di(a,f,b){let d=new _do;for(let c of _Nd(a))0<c&&_Ky.tabs.update(c,{muted:b.mode==_up?!_os[c].mutedInfo.muted:!!b.mode},d.onReady());d.setCallback(()=>f(a))}
function _Wa(a,f,b){let d=new _do;for(let c of _Nd(a))0<c&&_Ky.tabs.update(c,{[b.propName]:b.mode==_up?!_os[c][b.propName]:!!b.mode},d.onReady());d.setCallback(()=>f(a))}function _sj(a,f,b){_Wa(a,f,{}.add(b,{propName:"pinned"}))}
function _G(a,f,b){let d={true:[],false:[]};if(b.inclActTab){var c=_Nd(a);for(var e of _yg(c)){let h=_sk[e].activeTab.id;0>c.indexOf(h)&&a.push([h])}}for(var g of _Nd(a))c=_os[g],0>g||!c||(e=b.mode==_up?!_wk(c):!!b.mode,d[e][c.active?"push":"unshift"](g),e&&c.active&&_Ky.tabs.update(g,{highlighted:!1}));b=new _do;g={};for(let h of d[!0])c=_os[h].windowId,c in g||(g[c]=_sk[c].tabs.some(k=>_wk(k))),_Ky.tabs.update(h,{highlighted:!0,active:!g[c]},b.onReady()),g[c]=!0;for(let h of d[!1])_Ky.tabs.update(h,
{highlighted:!1},b.onReady());b.setCallback(()=>f(a))}function _4p(a,f,b){let d={},c=[];a[0]&&!_Mg(a[0])&&(a=[a]);for(let e of a){a=[];for(let g of e)f&&d[g]||b&&!b(g)||(d[g]=!0,a.push(g));a.length&&c.push(a)}return c}
let _at=_Et(function*(a,f,b,d){a=_4p(a,!0,e=>"normal"==_os[e].window.type);if("newWin"==b.pos)for(let e of a){b=_os[e[0]].window.tabs;if(b.length==e.length&&0==_3u(e,b.map(h=>h.id)).length)continue;b=e.filter(h=>_os[h].active)[0];let g=yield h=>_qg(e[0],h);1<e.length&&(yield h=>_Ky.tabs.move(e.slice(1),{windowId:g.id,index:-1},h),b&&_Ky.tabs.update(b,{active:!0}))}else{let e=_Nd(a);var c=!0;b.refTab&&(c=(yield _fr(d,_4j,b.refTab))[0][0]||_Ca,c=!(yield _ui(e,c,b.pos)))}f(c?[]:a)}),_ui=_wj(function*(a,
f,b){let d=_os[f];if(d&&"normal"==d.window.type){a="after"==b?a:a.slice().reverse();for(let c of a){if(c==f)continue;a=yield g=>_Ky.tabs.get(c,g);if(!a)continue;let e=d.index+("after"==b?1:0);a.windowId==d.windowId&&a.index<e&&--e;d=(yield g=>_Ky.tabs.move(c,{windowId:d.windowId,index:e},g))||d}return!0}});
function _qg(a,f){let b=_os[a].window;if(1<b.tabs.length){let d=_Qu,c={};"normal"==b.state&&(c=b.sc().keep("left","top","width","height"),d=g=>_Ky.windows.update(g.id,c));let e=_Hd(b)||b.state.in("maximized","fullscreen");_Ky.windows.create({tabId:a,focused:e,state:b.state,incognito:b.incognito}.add(c),g=>{d(g);f(g)})}else f(b)}function _Ht(a,f){let b=new _do;for(let d of _Nd(a))_qg(d,b.onReady());b.setCallback(()=>f(a))}
let _ku=_Et(function*(a,f,b,d){function c(h){let k={},n;for(let q of h)h=_os[q].windowId,k[h]=(k[h]|0)+1,k[h]<=k[n]||(n=h);return n}var e=_4p(a,!0,h=>"normal"==_os[h].window.type);let g=_Nd(e);if("no"==b.target)_Pt(g)||(yield h=>_Ky.tabs.ungroup(g,h));else if("new"==b.target){a=e;for(let h of a)_Pt(h)||(yield k=>_Ky.tabs.group({tabIds:h,createProperties:{windowId:c(h)}},k))}else if(a=e,!_Pt(g)&&(d=(yield _fr(d,_4j,b.refTab))[0][0],e=_Kg(_os[d],"groupId"),!b.noNewGrp||0<e))if(yield _ui(g,d,b.target)){let h=
0<e?{tabIds:g,groupId:e}:{tabIds:g.concat(d),createProperties:{windowId:c(g)}};yield k=>_Ky.tabs.group(h,k)}f(a)});
function _1p(a,f){let b,d=[.2,.21,.22,.23,.24,.25,.26,.275,.29,.305,.32,.335,.35,.365,.38,.4,.42,.44,.46,.48,.5,.52,.55,.58,.61,.64,.67,.7,.74,.78,.82,.86,.9,.95,1,1.05,1.1,1.15,1.2,1.27,1.34,1.4,1.47,1.55,1.63,1.7,1.8,1.9,2,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3,3.15,3.3,3.45,3.6,3.8,4,4.2,4.4,4.6,4.8,5,5.25,5.5,5.75,6];for(let c of 0<f?d:d.reverse())if(0<(c-a)*f&&(b=c,0==(f-=f/Math.abs(f))))break;return b}
function _9w(a,f,b=!1){_Ky.tabs.setZoomSettings(a,{scope:b?"per-tab":"per-origin"},()=>_fy()||_Ky.tabs.setZoom(a,f))}let _1t={};
function _H(a,f,b){for(let d of _Nd(a)){if(0>d)if(_os[d]&&_os[d].windowId==_Pd)d=null;else continue;_Ky.tabs.getZoom(d,c=>{c=_rt(c,3);let e=0==b.type?0:"custom"==b.type?b.amount/100:2==Math.abs(b.type)?_Qe(c+b.type/2*b.amount/100,.1,8):_1p(c,b.type*(b.steps||1));void 0!==e&&e!=c&&(b.perTab?(_Ky.tabs.onZoomChange.hasListeners()||_Ky.tabs.onZoomChange.addListener(g=>{500>Date.now()-_1t[g.tabId]||"per-origin"!=g.zoomSettings.scope&&_rt(g.oldZoomFactor,2)==_rt(g.newZoomFactor,2)||(delete _jh[g.tabId],
"per-tab"==g.zoomSettings.scope&&(_Ky.tabs.setZoomSettings(g.tabId,{scope:"per-origin"}),_Ky.tabs.setZoom(g.tabId,g.newZoomFactor)))}),_jh[d]=e,_1t[d]=Date.now()):delete _jh[d],_9w(d,e,b.perTab))})}f(a)}
function _ts(a,f,b){let d=_ih(_7f,b.listId,[]);for(let c of d)_os[c]||("function"==typeof d.remove?d.remove(c):_6p("badFavList",{list:d,listType:typeof d,listId:b.listId}));switch(b.oper){case "set":d=_7f[b.listId]=[];case "add":for(let c of _Nd(a))d.add(c);break;case "del":for(let c of _Nd(a))d.remove(c)}f(a)}function _b(a,f,b,d){_fr(d,_4j,b.tse,a)(f)};
